import React, { memo, useEffect } from 'react'
import route from './route'
import { useLocation, useNavigate, useRoutes,Navigate } from 'react-router-dom'
import Bottombar from './component/Bottombar'
const App = memo(() => {
  const location=useLocation()
  const  {pathname}=location
  const navigate=useNavigate()
  console.log(pathname);
  let token=localStorage.getItem('token')
  useEffect(()=>{
    if(pathname!='/Login'&&!token){
     navigate('/Login')
    }
  },[location])
  return (
    <div className='app'>
      <div className='top'>

      </div>
      <div className='body'>
        {useRoutes(route)}
        </div>
      <div className='bottom'>
      <Bottombar></Bottombar>
      </div>
    </div>
  )
})

export default App

